* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    padding: 10px;
    overflow-x: hidden;
}

.container {
    max-width: calc(100vw - 20px);
    margin: 0 auto;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 68px);
}

header {
    background: linear-gradient(90deg, #4b6cb7 0%, #182848 100%);
    color: white;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.logo {
    font-size: 22px;
    font-weight: 700;
    display: flex;
    align-items: center;
}

.logo-icon {
    margin-right: 12px;
    font-size: 24px;
}

.query-section {
    padding: 20px 30px;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}

.input-group {
    display: flex;
    gap: 15px;
}

#queryInput {
    flex: 1;
    padding: 14px 18px;
    border: 2px solid #e0e6ed;
    border-radius: 12px;
    font-size: 16px;
    transition: all 0.3s;
}

#queryInput:focus {
    outline: none;
    border-color: #4b6cb7;
    box-shadow: 0 0 0 3px rgba(75, 108, 183, 0.2);
}

#executeBtn {
    background: linear-gradient(90deg, #4b6cb7 0%, #182848 100%);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 0 25px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
}

#executeBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(75, 108, 183, 0.4);
}

.examples {
    margin-top: 15px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.example-btn {
    background: #f0f4f9;
    border: 1px solid #e0e6ed;
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.example-btn:hover {
    background: #e4ebf5;
    border-color: #c3cfe2;
}

.results-section {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.chart-container {
    flex: 2;
    padding: 20px;
    border-right: 1px solid #eee;
    position: relative;
    display: flex;
    flex-direction: column;
}

.summary-container {
    flex: 2;
    padding: 20px;
    background: #f9fbfd;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.section-title {
    font-size: 16px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
}

.section-title i {
    margin-right: 8px;
    font-size: 18px;
    color: #4b6cb7;
}

.chart-wrapper {
    flex: 1;
    position: relative;
    min-height: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #f8f9fa;
    border-radius: 12px;
    overflow: hidden;
}

#chartContainer {
    width: 100%;
    height: 100%;
    display: none;
}

.chart-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #7f8c8d;
    text-align: center;
    padding: 40px;
}

.chart-placeholder i {
    font-size: 48px;
    margin-bottom: 15px;
    color: #bdc3c7;
}

.loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    z-index: 10;
    border-radius: 12px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.loading.active {
    opacity: 1;
    pointer-events: all;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(75, 108, 183, 0.2);
    border-top: 4px solid #4b6cb7;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error-container {
    background: #fff0f0;
    border: 1px solid #ffcccc;
    border-radius: 8px;
    padding: 12px;
    margin-top: 15px;
    color: #e74c3c;
    display: none;
}

.status-bar {
    padding: 12px 30px;
    background: #f8f9fa;
    border-top: 1px solid #eee;
    font-size: 13px;
    color: #7f8c8d;
    display: flex;
    justify-content: space-between;
    flex-shrink: 0;
}

footer {
    text-align: center;
    padding: 15px;
    color: #7f8c8d;
    font-size: 13px;
    flex-shrink: 0;
}

.chart-status {
    margin-bottom: 12px;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 8px;
    font-size: 13px;
    color: #666;
}

.debug-info {
    margin-top: 10px;
    padding: 8px;
    background: #f5f5f5;
    border-radius: 4px;
    font-size: 11px;
    color: #888;
    display: none;
    max-height: 100px;
    overflow-y: auto;
}

.ai-summary {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    line-height: 1.6;
    font-size: 15px;
    color: #34495e;
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.ai-summary h3 {
    color: #4b6cb7;
    margin-bottom: 12px;
    font-size: 16px;
}

/* Markdown 样式 - 增强版 */
.markdown-content {
    line-height: 1.7;
}

.markdown-content h1 {
    color: #2c3e50;
    font-size: 1.5em;
    border-bottom: 2px solid #4b6cb7;
    padding-bottom: 8px;
    margin: 1.2em 0 0.8em 0;
}

.markdown-content h2 {
    color: #2c3e50;
    font-size: 1.3em;
    border-left: 4px solid #4b6cb7;
    padding-left: 12px;
    margin: 1.2em 0 0.8em 0;
}

.markdown-content h3 {
    color: #4b6cb7;
    font-size: 1.1em;
    margin: 1em 0 0.6em 0;
}

.markdown-content h4 {
    color: #7f8c8d;
    font-size: 1em;
    margin: 1em 0 0.6em 0;
}

.markdown-content p {
    margin-bottom: 1em;
}

.markdown-content ul, .markdown-content ol {
    margin: 1em 0;
    padding-left: 2em;
}

.markdown-content li {
    margin-bottom: 0.5em;
}

.markdown-content blockquote {
    border-left: 4px solid #bdc3c7;
    padding: 12px 16px;
    margin: 1.5em 0;
    background: #f8f9fa;
    border-radius: 0 8px 8px 0;
    font-style: italic;
}

.markdown-content code {
    background: #f1f3f4;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9em;
    color: #e74c3c;
}

.markdown-content pre {
    background: #2c3e50;
    color: #ecf0f1;
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 1.5em 0;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9em;
    line-height: 1.4;
}

.markdown-content pre code {
    background: none;
    padding: 0;
    color: inherit;
    font-size: inherit;
}

.markdown-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5em 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.markdown-content th {
    background: #4b6cb7;
    color: white;
    font-weight: 600;
    padding: 12px;
    text-align: left;
}

.markdown-content td {
    padding: 12px;
    border-bottom: 1px solid #e0e6ed;
}

.markdown-content tr:nth-child(even) {
    background: #f8f9fa;
}

.markdown-content a {
    color: #4b6cb7;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.3s;
}

.markdown-content a:hover {
    border-bottom: 1px solid #4b6cb7;
}

.markdown-content hr {
    border: none;
    height: 2px;
    background: linear-gradient(90deg, transparent, #bdc3c7, transparent);
    margin: 2em 0;
}

.markdown-content strong {
    font-weight: 700;
    color: #2c3e50;
}

.markdown-content em {
    font-style: italic;
    color: #7f8c8d;
}

/* 流式输出指示器 */
.streaming-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 15px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
}

.typing-animation {
    display: flex;
    gap: 3px;
}

.typing-animation span {
    height: 8px;
    width: 8px;
    background: #4b6cb7;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-animation span:nth-child(1) { animation-delay: 0s; }
.typing-animation span:nth-child(2) { animation-delay: 0.2s; }
.typing-animation span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 60%, 100% { transform: scale(0.8); opacity: 0.5; }
    30% { transform: scale(1); opacity: 1; }
}

/* 优化Markdown内容显示 */
.markdown-content {
    line-height: 1.7;
    font-size: 14px;
}

.markdown-content h1 {
    color: #2c3e50;
    font-size: 1.4em;
    border-bottom: 2px solid #4b6cb7;
    padding-bottom: 8px;
    margin: 1.2em 0 0.8em 0;
}

.markdown-content h2 {
    color: #2c3e50;
    font-size: 1.2em;
    border-left: 4px solid #4b6cb7;
    padding-left: 12px;
    margin: 1.2em 0 0.8em 0;
}

.markdown-content h3 {
    color: #4b6cb7;
    font-size: 1.1em;
    margin: 1em 0 0.6em 0;
}

.markdown-content ul {
    margin: 0.8em 0;
    padding-left: 1.5em;
}

.markdown-content li {
    margin-bottom: 0.3em;
}

/* 图表容器优化 */
.chart-wrapper {
    background: white;
    border-radius: 8px;
    padding: 10px;
}

/* 隐藏不必要的元素 */
.markdown-content .leads-section,
.markdown-content .phrase-optimization {
    display: none !important;
}